<template>
  <div style="margin-top: 50rem;">
    <cinema
      v-for="(item, index) in yingyuan"
      :key="item.id"
      :item="item"
      :index="index"
      @click="dianji(item),$router.push({ path: '/Cindetails',query:{id:item.cinemaId}})"
    >
    </cinema>
  </div>
</template>

<script setup>
import cinema from "@/components/cinema.vue";
import { ref } from "vue";
import axios from "@/api/thisaxios.js";

const gettime=ref([])

const getCurrentTime = () => {
  //获取当前时间并打印
  var _this = this;
  let yy = new Date().getFullYear();
  let mm = new Date().getMonth() + 1;
  let dd = new Date().getDate();
  gettime.value = yy + "-" + mm + "-" + dd ;
  // console.log(gettime);
};

getCurrentTime();


const myData = localStorage.getItem("cityId") || "default value";
// console.log(myData);
const cityName = localStorage.getItem("cityName") || "default value";
// console.log(cityName);

const dianji=(item)=>{
  // console.log(item.cinemaId);
}

const getDetail = () =>
  axios.get(
    `https://apis.netstart.cn/maoyan/index/moreCinemas?day=${gettime}&offset=0&limit=20&districtId=-1&lineId=-1&hallType=-1&brandId=-1&serviceId=-1&areaId=-1&stationId=-1&item&updateShowDay=true&reqId=1636710166221&cityId=${myData}`
  );


const yingyuan = ref([]);
// const dyingy = ref([]);
async function update() {
  const { data } = await getDetail();
  yingyuan.value = data;
  // dyingy.value = data;
  // console.log("yingyuan", yingyuan);
}
update();

</script>

<style lang="scss" scoped></style>
